<script language="javascript" type="text/javascript">
	
	function clear_results() {
		$('search_results').innerHTML = '';
	}
	
	function normal_search() {
		clear_results();
		$('search_search_type').value = 'normal';
		$('commit').value = 'Search';
	}
	
	function search_on_tags() {
		clear_results();
		$('search_search_type').value = 'on_tags';
		$('commit').value = 'Search on Tags';
	}
	
</script>

<% @page_title = ' :: Search' %>

<% content_for :sidebar do %>
	<%= render :partial => 'shared/login_space' unless logged_in? %>
	
	<div class="little_infos">
		<div class="little_content">
			<span class="sidebar_title">Search</span>
			<%= link_to_function 'Normal Search', 'normal_search();' %><br />
			<%= link_to_function 'Search on Tags', 'search_on_tags();' %><br />
		</div>
		
	<% if logged_in? %>
		<%= render :partial => 'shared/default_sidebar' %>
	<% end %>
	</div>
<% end %>

<div id="search_div" class="span-18 last">
	<% form_remote_for :search, :url => {:action => 'search'}, :update => 'search_results' do |f| %>
		<%= f.hidden_field :search_type, :value => 'normal' %>
		<%= f.text_field :keys, :class => 'text big_input' %>&nbsp;
		<%= submit_tag 'Search', :disable_with => 'Searching&hellip;', :class => 'buttons', :id => 'commit',
			:onmousedown => "$('search_div').morph('text-align: center; margin: 15px 5px 30px 5px; padding-top: 25px;'); return false;" %>
		
		<div class="span-7 right">
			<%= f.radio_button :search_item, :audio_assets, :checked => true %>
			<label for="search_search_item_audio_assets">Audio Assets</label>
		</div>
		
		<div class="span-3">
			<%= f.radio_button :search_item, :programs %>
			<label for="search_search_item_programs">Programs</label>
		</div>
		
		<div class="span-5 last">
			<%= f.radio_button :search_item, :broadcasts %>
			<label for="search_search_item_broadcasts">Broadcasts</label>
		</div>
	<% end %>
</div>
<div id="search_results"></div>
